<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
<!--
	function checkForm(){
		var subject = document.getElementById("subject");
		var context = document.getElementById("context");
		
		if(subject.value == ""){
			alert("信息主题不能为空！");
			return false;
		}
		
		if(context.value == ""){
			alert("主题内容不能为空！");
			return false;
		}
		
		return true;
	}

	function back(){
		window.location.href = "./newsNotice.do";
		window.location.target = "main";
	}
	
	function save(){
		if(checkForm()){
			document.addNewsNoticeForm.action = "./newsNotice.do?action=addNewsNotice";
			document.addNewsNoticeForm.target = "main";
			document.addNewsNoticeForm.submit();
		}
	}
	
	function initPage(){
		if("<c:out value='${result}'/>" == 1){
			alert("保存成功！");
		}
	}
-->
</script>
</head>
<body onload="initPage()">
<form name="addNewsNoticeForm" action="" method="post">
	<table class="table_frame">
		<tr>
			<td>
				<table class="table_title1">
					<tr>
						<td class="title_lab" colspan="3">
							添加公司新闻
						</td>
					</tr>
					<tr>
						<td align="center" valign="bottom">
							<button class="btn_submit" onclick="save()" hidefocus="true">提交</button>&nbsp;&nbsp;
							<button class="btn_back" onclick="back()" hidefocus="true">取消并返回</button>
						</td>
					</tr>
					<tr><td height="2"></td></tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table class="table_title2">
					<tr>
						<td>
							<table class="table_add">
								<tr>
									<td class="title">信息主题：</td>
									<td><input id="subject" name="subject" class="input_msg" type="text" value="${newsNotice.subject}" maxlength="50"/></td>
								</tr>
								<tr>
									<td class="title">发布时间：</td>
									<td>
										<fmt:formatDate value="<%=new java.util.Date() %>" pattern="yyyy-MM-dd"/>
										<input id="sendDate" name="sendDate" type="hidden" 
											value="<fmt:formatDate value='<%=new java.util.Date() %>' pattern='yyyy-MM-dd'/>"/>
									</td>
								</tr>
								<tr>
									<td class="title">发布人：</td>
									<td>
										${userName}
										<input id="sendPersonId" name="sendPersonId" type="hidden" value="${userId}"/>
									</td>
								</tr>
								<tr>
									<td class="title">主题内容：</td>
									<td><textarea id="context" name="context" class="textarea_msg" wrap="hard">${newsNotice.context}</textarea></td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>	
</body>
</html>